package com.vegetable.modules.service.inbound;

import com.baomidou.mybatisplus.extension.service.IService;
import com.vegetable.common.utils.PageUtils;
import com.vegetable.common.utils.R;
import com.vegetable.modules.entity.finance.po.ADCanPayPO;
import com.vegetable.modules.entity.inbound.AgentDelivery;
import com.vegetable.modules.entity.inbound.AgentDeliveryDetail;
import com.vegetable.modules.entity.inbound.export.AgentDeliveryImport;
import com.vegetable.modules.entity.inbound.po.AgentDeliverySequencePO;
import com.vegetable.modules.entity.stock.Stock;
import com.vegetable.modules.service.stock.IStockService;
import com.vegetable.modules.vo.AgentDeliveryDetailVO;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 入库-代办交货 服务类
 * </p>
 *
 * @author wangruijie
 * @since 2024-03-07
 */
public interface IAgentDeliveryService extends IService<AgentDelivery> {

    /**
     * 入库代办交货列表查询
     * @param params
     * @return
     */
    PageUtils queryPage(Map<String, Object> params);

    /**
     * 入库代办交货列表查询统计
     * @param params
     * @return
     */
    Map<String, Object> queryPageStatistics(Map<String, Object> params);

    /**
     * 入库代办交货总表查询
     * @param params
     * @return
     */
    Map<String, Object> sequence(AgentDeliverySequencePO po);

    /**
     * 详情入库代办交货
     * @param id null
     * @return R
     * @author wrj
     * @since 2024/3/7 下午4:35
     */
    R detailAgentDelivery(Long id);

    /**
     * 新增入库代办交货
     * @param agentDelivery null
     * @return R
     * @author wrj
     * @since 2024/3/7 下午4:35
     */
    R<AgentDelivery> saveOrEdit(AgentDelivery agentDelivery) throws Exception;

    /**
     * 提交入库代办交货
     * @param agentDelivery null
     * @return R
     * @author wrj
     * @since 2024/3/7 下午4:35
     */
    R submitAgentDelivery(AgentDelivery agentDelivery) throws Exception;

    R currentAgentDelivery(AgentDelivery agentDelivery) throws Exception;

    /**
     * 删除入库代办交货
     * @param id null
     * @return R
     * @author wrj
     * @since 2024/3/7 下午4:35
     */
    R deleteAgentDelivery(Long id) throws Exception;

    /**
     * 查询（未对账金额 > 0）可收款的待办交货
     * @param agentId null
     * @return List<AgentDelivery>
     * @author wrj
     * @since 2024/4/15 下午12:21
     */
    Map<String, Object> canPaymentList(ADCanPayPO po);

    /**
     * 批量导入待办交货
     * @param orderList
     * @param orderId
     * @return
     */
    R uploadAgentDelivery(List<AgentDeliveryImport> orderList) throws Exception;

    /**
     * 当日待办交货下商品列表
     * @param agentId null
     * @return List<AgentDeliveryDetailVO>
     * @author wrj
     * @since 2024/7/1 下午8:59
     */
    List<AgentDelivery> todayAgentDelivery(Long agentId, String orderTime);

    List<AgentDeliveryDetail> lastOrder(Long customerId);

    R preCurrentAgentDelivery(AgentDelivery agentDelivery) throws Exception;

    R<AgentDelivery> confirm(AgentDelivery agentDelivery) throws Exception;
    
    /**
     * 获取库存服务
     * @return IStockService
     */
    IStockService getStockService();
}